package com.xoa.controller.inv;

import com.xoa.dao.inv.CusPaymentMapper;
import com.xoa.model.inv.CusPayment;
import com.xoa.model.inv.CusReceipt;
import com.xoa.service.crm.CustomerService;
import com.xoa.service.inv.CusReceiptService;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

//收款单付款单
@Controller
@RequestMapping("/cusReceipt")
public class CusReceiptController {

    @Autowired
    CusReceiptService cusReceiptService;

    /**
     * 添加收款单数据
     * @param cusReceipt
     * @return
     */
    @ResponseBody
    @RequestMapping("/insertCusRecepit")
    public ToJson<CusReceipt> insertCusRecepit(CusReceipt cusReceipt){
       return cusReceiptService.insertCusReceipt(cusReceipt);
    }

    /**
     * 修改付款单数据
     * @param cusReceipt
     * @return
     */
    @ResponseBody
    @RequestMapping("/updateCusRecepit")
    public ToJson<CusReceipt> updateCusRecepit(CusReceipt cusReceipt){
        return cusReceiptService.updateCusReceipt(cusReceipt);
    }

    /**
     * 展示所有收款单数据
     * @param cusReceipt
     * @param page
     * @param limit
     * @param month
     * @param year
     * @return
     */
    @ResponseBody
    @RequestMapping("/selectCusRecepit")
    public ToJson<CusReceipt> selectCusRecepit(CusReceipt cusReceipt,Integer page,Integer limit,String month,String year){
        return cusReceiptService.selectCusRecepit(cusReceipt,page,limit,month,year);
    }

    /**
     * 删除指定收款数据
     * @param receiptId
     * @return
     */
    @ResponseBody
    @RequestMapping("/deleteCusRecepit")
    public ToJson<CusReceipt> deleteCusRecepit(String receiptId){
        return cusReceiptService.deleteCusRecepit(receiptId);
    }

    /**
     * 修改的回显
     * @param cusReceipt
     * @return
     */
    @ResponseBody
    @RequestMapping("/selectOneCusRecepit")
    public ToJson<CusReceipt> selectOneCusRecepit(CusReceipt cusReceipt){
        return cusReceiptService.selectOneCusRecepit(cusReceipt);
    }

    /**
     * 添加付款单数据
     * @param cusPayment
     * @return
     */
    @ResponseBody
    @RequestMapping("/insertCusPayment")
    public ToJson<CusPayment> insertCusPayment(CusPayment cusPayment){
        return cusReceiptService.insertCusPayment(cusPayment);
    }

    /**
     * 修改付款单数据
     * @param cusPayment
     * @return
     */
    @ResponseBody
    @RequestMapping("/updateCusPayment")
    public ToJson<CusPayment> updateCusPayment(CusPayment cusPayment){
        return cusReceiptService.updateCusPayment(cusPayment);
    }

    /**
     * 展示所有付款单数据
     * @param cusPayment
     * @param page
     * @param limit
     * @param month
     * @param year
     * @return
     */
    @ResponseBody
    @RequestMapping("/selectCusPayment")
    public ToJson<CusPayment> selectCusPayment(CusPayment cusPayment,Integer page,Integer limit,String month,String year){
        return cusReceiptService.selectCusPayment(cusPayment,page,limit,month,year);
    }

    /**
     * 删除指定付款数据
     * @param paymentId
     * @return
     */
    @ResponseBody
    @RequestMapping("/deleteCusPayment")
    public ToJson<CusPayment> deleteCusPayment(String paymentId){
        return cusReceiptService.deleteCusPayment(paymentId);
    }

    /**
     * 修改的回显
     * @param cusPayment
     * @return
     */
    @ResponseBody
    @RequestMapping("/selectOneCusPayment")
    public ToJson<CusPayment> selectOneCusPayment(CusPayment cusPayment){
        return cusReceiptService.selectOneCusPayment(cusPayment);
    }
}
